package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseRole;
import com.briup.recognition.bean.BaseRoleExample;
import com.briup.recognition.bean.BaseUser;
import com.briup.recognition.bean.BaseUserExample;
import com.briup.recognition.dao.BaseRoleMapper;
import com.briup.recognition.service.IBaseRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: kun
 * @Description: 业务实现类叭
 * @DateTime: 2021/3/28$ 22:47$
 * @Params: $
 * @Return $
 */
@Service
public class BaseRoleServiceImpl implements IBaseRoleService {
    @Resource
    private BaseRoleMapper baseRoleMapper;

    @Override
    public List<BaseRole> query(){
        BaseUserExample example = new BaseUserExample();
        return  baseRoleMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdata(BaseRole baseRole) {
        if(baseRole.getId()!=null){
            baseRoleMapper.updateByPrimaryKey(baseRole);
        }else {
            baseRoleMapper.insert(baseRole);
        }
    }


    @Override
    public  void deleteById(long id){
        baseRoleMapper.deleteByPrimaryKey(id);
    }



}